package com.kuang.service.impl;


import com.kuang.dao.UserMapper;
import com.kuang.pojo.User;
import com.kuang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String username, String password) {
        return userMapper.selectUserByNameAndPwd(username, password);
    }

    @Override
    public User selectUser() {
        return userMapper.selectUser();
    }

    @Override
    public int updateUser(User user) {
//        user.setUpdateTime(new Date());
        return userMapper.updateUser(user);
    }

    @Override
    public User checkOldPwd(String oldpwd) {
        return userMapper.checkOldPwd(oldpwd);
    }

    @Override
    public int updatepwd(String password, Integer id, Date updatetime) {
        return userMapper.updatepwd(password, id, updatetime);
    }

    @Override
    public User selectAdminUser(Integer id) {
        return userMapper.selectAdminUser(id);
    }


}
